package ch.wanandroid.present;

import android.util.Log;

import java.util.ArrayList;
import java.util.List;

import ch.wanandroid.lib.banner.BannerItem;
import ch.wanandroid.lib.net.beans.BannerResponse;
import ch.wanandroid.model.HomeModelImpl;
import ch.wanandroid.model.IHomeModel;

import ch.wanandroid.model.OnLoadCompleteListener;
import ch.wanandroid.view.HomeFragment;
import ch.wanandroid.view.IHomeView;

/**
 * Author: ch
 * Date: 2018/10/22 14:13
 * Description: ${DESCRIPTION}
 */

public class HomePresent extends BasePresenter<IHomeView>{

    private IHomeModel mHomeModel;
    private IHomeView mIHomeView;
    private List<BannerItem> mBannerItemList=new ArrayList<>();
    public HomePresent(){
        mHomeModel=new HomeModelImpl();
    }

    public void fetch() {
        mIHomeView=mViewRef.get();
        mIHomeView.showLoading();
        mHomeModel.loadBannerData(new IHomeModel.OnLoadCompleteListener() {
            @Override
            public void onComplete(List<BannerItem> data) {
                mIHomeView.showData(data);
            }
        });
    }
}
